package com.rm.zeyou.mapper;

import com.rm.zeyou.entity.Message;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.rm.zeyou.vo.response.SelectMessageListResponseVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * 消息表 Mapper 接口
 * </p>
 *
 * @author YanYang
 * @since 2025-03-13 09:51:59
 */
@Mapper
public interface MessageMapper extends BaseMapper<Message> {

    @Delete("delete from t_message where order_no = #{orderNo}")
    Integer deleteMessage(@Param("orderNo") String orderNo);

    List<SelectMessageListResponseVo> selectMessageList(@Param("userId") Long userId);

    @Update("update t_message set is_read = 1 where id = #{messageId}")
    Integer readMessage(@Param("messageId") Long messageId);

    @Delete("delete from t_message where user_id = #{userId}")
    Integer deleteMessageAll(@Param("userId") Long userId);
}
